package com.evil.application.pojo.dto.form.control.code.config;

import cn.hutool.core.collection.CollUtil;
import com.evil.common.application.dto.judge.JudgeAnd;
import com.evil.common.application.dto.judge.JudgeOr;
import lombok.Data;

import javax.validation.Valid;
import java.util.ArrayList;
import java.util.List;

@Data
public class FilterConfigDTO {

    /**
     * 或条件列表
     */
    @Valid
    private List<JudgeOr> judgeOrs;

    public FilterConfigDTO() {
        this.judgeOrs = new ArrayList<>();
    }

    public FilterConfigDTO(List<JudgeOr> judgeOrs) {
        this.judgeOrs = judgeOrs;
    }

    public FilterConfigDTO(JudgeAnd... judgeAnds) {
        this.judgeOrs = CollUtil.toList(new JudgeOr(CollUtil.toList(judgeAnds)));
    }
}
